<ion-header>

  <ion-navbar>
    <ion-title>{{type === 'password'? '修改密码':'修改支付密码'}}</ion-title>
    <ion-buttons start>
      <button ion-button (click)="dismiss()">
        <ion-icon name="md-close"></ion-icon>
      </button>
    </ion-buttons>
  </ion-navbar>

</ion-header>


<ion-content padding>

  <form [formGroup]="validateForm" (submit)="updatePassword($event)">

    <ion-item>
      <ion-label fixed for="password">
        <ion-icon name="md-unlock"></ion-icon>
      </ion-label>
      <ion-input type="password" id="password" formControlName="password" placeholder="请输入密码"
                 (ngModelChange)="updateConfirmValidator()"></ion-input>
    </ion-item>
    <div class="error-message" *ngIf="getFormControl('password').dirty&&getFormControl('password').errors">
      <ng-container *ngIf="getFormControl('password').hasError('required')">请输入密码</ng-container>
    </div>

    <ion-item>
      <ion-label fixed for="confirmPwd">
        <ion-icon name="md-unlock"></ion-icon>
      </ion-label>
      <ion-input type="password" id="confirmPwd" formControlName="confirmPwd" placeholder="请再次输入密码"></ion-input>
    </ion-item>
    <div class="error-message" *ngIf="getFormControl('confirmPwd').dirty&&getFormControl('confirmPwd').errors">
      <ng-container *ngIf="getFormControl('confirmPwd').hasError('required')">请再次输入密码</ng-container>
      <ng-container *ngIf="getFormControl('confirmPwd').hasError('confirm')">两次密码不一致</ng-container>
    </div>

    <button class="mt-20" ion-button color="primary" block type="submit">提交</button>
  </form>
</ion-content>
